from peewee import *

from config.base_config import *

db = get_db()


class BaseModel(Model):
    class Meta:
        database = db


class HedgingCandle(BaseModel):
    c_price = DecimalField(null=True)
    h_price = DecimalField(null=True)
    id = BigAutoField()
    inst_id = CharField(null=True)
    l_price = DecimalField(null=True)
    o_price = DecimalField(null=True)
    s_time = BigIntegerField(null=True)
    status = IntegerField(null=True)
    create_time = DateTimeField()

    class Meta:
        table_name = 'hedging_candle'


class HedgingInstInfo(BaseModel):
    inst_id = CharField(null=True)
    server_num = IntegerField()  # 服务器编号
    max_lever = IntegerField()
    mini_amount = DecimalField(null=True)
    create_time = DateTimeField()
    update_time = DateTimeField()

    class Meta:
        table_name = 'hedging_inst_info'
